Dear John, thanks, I did not know Brian Ripley's R News article yet, though I did know the web sources on translation. I don't even have to change the language for checking translation, because I am always in a German system and program everything in English - if it works I see it in my language :-)
I suppose I will have to create the po files for package-specific messages (that should be doable) and to somehow compile these into mo files (I don't quite know how to do that yet, I seem to have to install GNU gettext and take it from there). For my current prototype phase, I think I will simply stick with the msgcat solution and later replace the internationalization function with a function based on gettext. Since the main work work on the package will only start next year, I am currently only interested in fixing conceptual thoughts and checking principle feasibility of things I would like to include. Thanks again, Regards, Ulrike John Fox wrote: > > Dear Ulrike, > > Using gettext within R is really quite simple. You're probably aware of > this, but just in case, you can consult Brian Ripley's article in the May > 2005 R News, the section on internationalization and localization in the R > Installation and Administration manual, and the document at > <http://developer.r-project.org/Translations.html>. > > Under Windows, you can check that that your translation is working by, > e.g., setting the language in the target field of a shortcut to Rgui. For > example, I typically check in Spanish with the target field set to > C:\R\R-2.8.0\bin\Rgui.exe language=es. > > I hope this helps, > John > > ------------------------------ > John Fox, Professor > Department of Sociology > McMaster University > Hamilton, Ontario, Canada > web: socserv.mcmaster.ca/jfox > > >> -----Original Message----- >> From: [EMAIL PROTECTED] [mailto:r-sig-gui- >> [EMAIL PROTECTED] On Behalf Of Ulrike Groemping >> Sent: November-11-08 9:17 AM >> To: r-sig-gui@stat.math.ethz.ch >> Subject: Re: [R-gui] tcltk internationalization for built-in buttons >> >> >> Hello Philippe, >> >> I see now that I was being naive in assuming that resetting language >> settings in Windows would do anything to the buttons - they of course >> sell >> multilanguage support nowadays, and I seem to have a one-language-only >> version. >> >> I think that I can live with option 1). If users understand their Windows >> buttons, they will also understand the R buttons, and I can use my time >> better than spending it on 2) and 3). (Of course, users of Rcmdr will >> appreciate that buttons and messages match!) >> >> Regarding msgcat vs. R-internal, I only resorted to msgcat because I >> found >> it easier to find out how to use it. I think I will replace the ilab >> function in my toy example by a gettext version as soon as I find out how >> to >> do that (I suppose I can take that from the .onLoad function in Rcmdr). >> However, I cannot check that it works before I have packaged my package, >> can >> I ? That's a disadvantage of the R-internal approach vs. the msgcat >> approach >> at the stage I am currently in. >> >> By the way, do you know why tcltk2 causes the two commands below to stop >> functioning? >> tcl("::msgcat::mcload","C:/testdirectory") >> ilab <- function(lab) >> tclvalue(tcl("namespace","eval","::tcl::minidummy","::msgcat::mc",.Tcl.args(l >> ab))) >> >> Regards, Ulrike >> >> >> >> Philippe Grosjean wrote: >> > >> > Hello Ulrike, >> > >> > I think that the reason why default buttons are not translated is >> > because they are managed by Windows. You have no control on their text. >> > Running on a Windows in English, you got those buttons in English, >> > Windows in German -> buttons in German, etc... >> > So, three options from there: >> > >> > 1) You just assume that the end-users want the GUI in the same language >> > as Windows,... or accept to have default buttons in Window's language >> if >> > they switch to another internationalisation, >> > >> > 2) Do the same as in R commander: rewrite the dialog boxes so that they >> > don't use default Windows buttons (almost impossible for file >> > open/close, dir choose, etc. dialog boxes)! >> > >> > 3) Use AutoIt or AutoHotKey to change the default buttons messages >> (with >> > lots of sweat, you can compile a satellite program to do so),... or >> with >> > even more time and effort, compile a C function in R that calls the >> > right API to change default buttons' messages in your dialog boxes. >> > >> > Sorry that I cannot give you a better solution... >> > >> > Oh yes, regarding translation of Tcl/Tk messages from within R, I >> really >> > believe that translating these messages using the R mechanism instead >> of >> > msgcat in Tcl is much better. That way, you centralize all translations >> > (R functions and GUI elements) in a single translation file. It is the >> > approach used by R Commander, by the way. So, you got inspiration from >> > there for your own code. >> > Best, >> > >> > Philippe >> > ..............................................<°}))><........ >> > ) ) ) ) ) >> > ( ( ( ( ( Prof. Philippe Grosjean >> > ) ) ) ) ) >> > ( ( ( ( ( Numerical Ecology of Aquatic Systems >> > ) ) ) ) ) Mons-Hainaut University, Belgium >> > ( ( ( ( ( >> > .............................................................. >> > >> > Ulrike Groemping wrote: >> >> Dear R-SIG-GUIs, >> >> >> >> documentation of getLanguage / setLanguage in tcltk2 pointed me >> towards >> >> the >> >> msgcat package in Tcl/Tk, and I used it for internationalizing my GUI >> >> entries - trying to avoid having to write individual tools like >> >> RcmdrTkmessagebox etc. I am an absolute Tcl/Tk beginner and still >> looking >> >> for the final strategy to do a larger GUI project in, currently >> working >> >> on >> >> Windows with R 2.8.0 or R 2.7.1 (behave identical). And one important >> >> aspect >> >> is internationalization. >> >> >> >> I have now managed to program my draft and not yet functional GUI in >> >> English >> >> and show it in German by using an msg file with msgcat. On my >> computer, >> >> everything shows well in German. Then I got the idea that it would be >> >> nice >> >> to show an msgcat example in the help for getLanguage/setLanguage, and >> I >> >> prepared a toy example for sending to Philippe (cf. below). However, >> >> while >> >> changing the language does change most messages, it does not work with >> >> built-in buttons - these remain German on my machine, even if I >> restart >> >> my >> >> computer after changing system settings for all language aspects I >> could >> >> find on my computer from German to English. >> >> >> >> I remember having read something like that from John, when he started >> >> internationalizing Rcmdr, but I had thought it would be long solved by >> >> now. >> >> Since internationalization appears to work at installation time >> >> (otherwise >> >> my buttons wouldn't be in German), and since there are many tcltk >> message >> >> files in the Tcl directory, it looks to me - as a possibly rather >> naive >> >> tcltk novice - that one would just have to find a way to reset some >> >> environment variable or otherwise direct tcltk to look in the right >> >> places. >> >> >> >> Any thoughts on that ? >> >> >> >> Regards, Ulrike >> >> >> >> ####### the toy example follows >> >> require(tcltk) >> >> ### the following two lines must be executed BEFORE loading tcltk2 >> >> ### otherwise they do not work !!! >> >> tcl("::msgcat::mcload","C:/testdirectory") >> >> ilab <- function(lab) >> >> >> tclvalue(tcl("namespace","eval","::tcl::minidummy","::msgcat::mc",.Tcl.args(l >> ab))) >> >> >> >> ## mini example of German tcl message file >> >> ## has to be saved under name de.msg >> >> ## in the testdirectory given above >> >> ## without the comment character in lines below >> >> ## (it is important to avoid line breaks within individual mset >> entries) >> >> #namespace eval ::tcl::minidummy { >> >> # ::msgcat::mcset de "If you choose Yes, all unsaved inputs will be >> >> lost." >> >> "Wenn Sie Ja wählen, gehen alle noch nicht gespeicherten Eingaben >> >> verloren." >> >> # ::msgcat::mcset de "Really Exit WITHOUT Save ?" "Wirklich OHNE >> >> Speichern Beenden ?" >> >> # ::msgcat::mcset de "Yes pressed" "Ja gedrückt" >> >> # ::msgcat::mcset de "No pressed" "Nein gedrückt" >> >> #} >> >> >> >> imsgboxtest <- function(){ >> >> td <- tclvalue(tkmessageBox(message=ilab("If you choose Yes, all >> unsaved >> >> inputs will be lost."), >> >> title=ilab("Really Exit WITHOUT Save >> >> ?"),type="yesno",default="yes",icon="question")) >> >> if (td == "yes") cat(paste(ilab("Yes pressed"),"\n")) else >> >> cat(paste(ilab("No pressed"),"\n")) >> >> } >> >> imsgboxtest() >> >> >> >> require(tcltk2) ## ruins functionality of the load and function >> >> definition >> >> above >> >> ## if loaded too early! >> >> oldlang <- getLanguage() >> >> if (oldlang != "") { >> >> # Switch to English and test a command that issues a warning >> >> if (setLanguage("en_US")) imsgboxtest() >> >> # Switch to French and test a command that issues a warning >> >> if (setLanguage("fr_FR")) imsgboxtest() >> >> # Switch to German and test a command that issues a warning >> >> if (setLanguage("de_DE")) imsgboxtest() >> >> # Restore previous language >> >> setLanguage(oldlang) >> >> } >> >> >> > >> > >> > -- >> > ..............................................<°}))><........ >> > ) ) ) ) ) >> > ( ( ( ( ( Prof. Philippe Grosjean >> > ) ) ) ) ) >> > ( ( ( ( ( Numerical Ecology of Aquatic Systems >> > ) ) ) ) ) Mons-Hainaut University, Belgium >> > ( ( ( ( ( >> > .............................................................. >> > >> > _______________________________________________ >> > R-SIG-GUI mailing list >> > R-SIG-GUI@stat.math.ethz.ch >> > https://stat.ethz.ch/mailman/listinfo/r-sig-gui >> > >> > >> >> -- >> View this message in context: http://n2.nabble.com/tcltk- >> internationalization-for-built-in-buttons-tp1484614p1485165.html >> Sent from the R Sig Gui mailing list archive at Nabble.com. >> >> _______________________________________________ >> R-SIG-GUI mailing list >> R-SIG-GUI@stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/r-sig-gui > > _______________________________________________ > R-SIG-GUI mailing list > R-SIG-GUI@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/r-sig-gui > > -- View this message in context: http://n2.nabble.com/tcltk-internationalization-for-built-in-buttons-tp1484614p1486813.html Sent from the R Sig Gui mailing list archive at Nabble.com. _______________________________________________ R-SIG-GUI mailing list R-SIG-GUI@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-gui